//
//  ViewController.m
//  Block&PerformSelector
//
//  Created by lirenqiang on 2016/11/3.
//  Copyright © 2016年 1111. All rights reserved.
//

#import "ViewController.h"
#import "A.h"
typedef void (^modifyVarBlock)();

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    __block NSString *name = @"123";
    NSMutableString *strM = [NSMutableString stringWithFormat:@"%@", @"abc"];
    __block NSInteger count = 0;
    A *a = A.new;
    a.age = 20;
    // Block modify var
    modifyVarBlock mb = ^(){
        // count should use __block
        count = 10;
        name = @"456";
        a.age = 40;
        
    };
    mb();
    NSLog(@"name = %p, strM = %p", name, strM);
    NSLog(@"count = %zd, name = %@, a.age = %zd", count, name, a.age);
    
}

@end
